<template>
<div class="public-common">
    <!--业务办理 && 交通事故-->
    <div class="public-title">交通事故列表</div>
    <div class="public-searchbox">
        <el-row>
            <el-col :span="6">
                <el-input placeholder="请输入内容" v-model="form.test" class="input-with-select"  size="mini" />
            </el-col>
            <el-col :span="18">
                <el-button type="primary" icon="el-icon-search" size="mini"  style="margin-left:10px;">搜索</el-button>
                <el-button type="success" size="mini"  icon="el-icon-edit-outline">新建</el-button>
                <el-button type="danger" size="mini"  icon="el-icon-delete">注销</el-button>
                <el-button type="warning" size="mini"  icon="el-icon-printer">打印</el-button>
                <el-button type="warning" icon="el-icon-download" size="mini" >导出Excel</el-button>
            </el-col>
        </el-row>
    </div>
    <el-scrollbar class="public-scroll">
        <el-table :data="tabledata" size="mini" border stripe header-row-class-name="textcenter">
            <el-table-column
            type="selection"
            width="55" fixed="left">
            </el-table-column>
            <el-table-column
                label="发生时间">
                <template slot-scope="scope">
                    {{scope.row.carId}}
                </template>
            </el-table-column>                
            <el-table-column
                label="发生地点">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="车牌号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="车型">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="对方车牌号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="对方车型">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="对方车辆单位">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="对方司机姓名">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="对方驾驶证编号">
                <template slot-scope="scope">
                    {{scope.row.carId}}
                </template>
            </el-table-column>                
            <el-table-column
                label="事故类型">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="受伤人数">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="死亡人数">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="责任划分">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="定损金额">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="车损部位">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="赔付金额">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="收到材料日期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="提交保险公司日期">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="调节机关">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="事故登记时间">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="结案时间">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>    
            <el-table-column
                label="经办人">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="注销状态">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="备注">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>    
            <el-table-column
                label="操作" fixed="right">
                <template slot-scope="scope">
                    <el-button type="primary" size="mini">编辑</el-button>
                </template>
            </el-table-column> 
            
        </el-table>
    </el-scrollbar>
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.now"
        :page-sizes="page.sizes"
        :page-size="page.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total" style="margin-top:10px;">
    </el-pagination>

    <!--dialog-->
    <el-dialog :visible.sync="dialog.isVisible" width="60%" top="10vh">
        <div class="dialog-navtab">
                <div v-for="(name,index) in dialog.navtab.arr" :key="index" :class="index==dialog.navtab.currIndex?'dialog-navactive':''" @click="dialogNav(index)">
                    {{name}}
                </div>
            </div>
            <el-scrollbar style="height:350px;">
                <template v-if="dialog.navtab.currIndex == 0">
                    <el-row>
                        <el-col :span="12">
                            <el-form label-width="120px" size="mini">
                                <el-form-item label="事故发生时间">
                                    <el-date-picker
                                    v-model="dialog.test"
                                    type="datetime"
                                    format="yyyy-MM-dd HH:mm"
                                    value-format="yyyy-MM-dd HH:mm"
                                    placeholder="选择日期时间" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                            </el-form>
                            <div class="public-box">
                                <div class="public-box-tit">甲方车辆(出租车)</div>
                                <el-form label-width="60px" size="mini">
                                    <el-form-item label="车牌号">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                    <el-form-item label="车型">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                    <el-form-item label="单位">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                </el-form>
                            </div>
                            <div class="public-box">
                                <div class="public-box-tit">甲方责任人(出租车)</div>
                                <el-form label-width="60px" size="mini">
                                    <el-form-item label="姓名">
                                        <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                            <el-option
                                            v-for="item in select.responsibleer"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="性别">
                                                <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                                    <el-option
                                                    v-for="item in select.sexs"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="年龄">
                                                <el-input v-model="dialog.test"></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-form-item label="驾照号">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                </el-form>
                            </div>
                            <el-form label-width="120px" size="mini"  style="margin-top:10px;">
                                <el-form-item label="事故类型">
                                    <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                        <el-option
                                        v-for="item in select.accidenttype"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="受伤人数">
                                            <el-input v-model="dialog.test"></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="死亡人数">
                                            <el-input v-model="dialog.test"></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-form-item label="事故概况">
                                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="事故登记时间">
                                    <el-date-picker
                                    v-model="dialog.test"
                                    type="datetime"
                                    format="yyyy-MM-dd HH:mm"
                                    value-format="yyyy-MM-dd HH:mm"
                                    placeholder="选择日期时间" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                <el-form-item label="经办人">
                                    <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                        <el-option
                                        v-for="item in select.operators"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                <el-form-item label="处理方式">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="处理结果">
                                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="司机再教育时间">
                                    <el-date-picker
                                    v-model="dialog.test"
                                    type="datetime"
                                    format="yyyy-MM-dd HH:mm"
                                    value-format="yyyy-MM-dd HH:mm"
                                    placeholder="选择日期时间" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                <el-form-item label="结案时间">
                                    <el-date-picker
                                    v-model="dialog.test"
                                    type="datetime"
                                    format="yyyy-MM-dd HH:mm"
                                    value-format="yyyy-MM-dd HH:mm"
                                    placeholder="选择日期时间" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                <el-form-item label="备注">
                                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="dialog.test"></el-input>
                                </el-form-item>
                            </el-form>
                        </el-col>
                        <el-col :span="11" :offset="1">
                            <el-form label-width="120px" size="mini">
                                <el-form-item label="发生地点">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                            </el-form>
                            <div class="public-box">
                                <div class="public-box-tit">乙方车辆(事故车辆)</div>
                                <el-form label-width="60px" size="mini">
                                    <el-form-item label="车牌号">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                    <el-form-item label="车型">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                    <el-form-item label="单位">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                </el-form>
                            </div>
                            <div class="public-box">
                                <div class="public-box-tit">乙方责任人(事故车辆)</div>
                                <el-form label-width="60px" size="mini">
                                    <el-form-item label="姓名">
                                        <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                            <el-option
                                            v-for="item in select.responsibleer"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                            </el-option>
                                        </el-select>
                                    </el-form-item>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="性别">
                                                <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                                    <el-option
                                                    v-for="item in select.sexs"
                                                    :key="item.value"
                                                    :label="item.label"
                                                    :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="年龄">
                                                <el-input v-model="dialog.test"></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-form-item label="驾照号">
                                        <el-input v-model="dialog.test"></el-input>
                                    </el-form-item>
                                </el-form>
                            </div>
                            <el-form label-width="140px" size="mini" style="margin-top:10px;">
                                <el-form-item label="责任划分">
                                    <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                                        <el-option
                                        v-for="item in select.dutys"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                                <el-form-item label="定损金额">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="车辆损坏情况">
                                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="收到材料日期">
                                    <el-date-picker
                                    v-model="dialog.test"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    value-format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                <el-form-item label="事故材料">
                                    <div style="display:flex">
                                        <el-upload
                                        action="##"
                                        :on-change="handleChange">
                                            <el-button size="mini" type="primary" icon="el-icon-upload2">上传文件</el-button>
                                        </el-upload>
                                        <el-input v-model="dialog.test" style="margin-left:10px" disabled></el-input>
                                    </div>                                    
                                </el-form-item>
                                <el-form-item label="提交保险公司日期">
                                    <el-date-picker
                                    v-model="dialog.test"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    value-format="yyyy-MM-dd"
                                    placeholder="选择日期" style="width:100%;">
                                    </el-date-picker>
                                </el-form-item>
                                <el-form-item label="保险公司签收人">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="交强险赔付金额">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="商业险赔付金额">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="总赔付金额">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="调解机关">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="违约金额">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="违约比例">
                                    <el-input v-model="dialog.test"></el-input>
                                </el-form-item>
                                <el-form-item label="是否注销">
                                    <el-checkbox v-model="dialog.checked">已注销</el-checkbox>
                                </el-form-item>
                            </el-form>
                            
                        </el-col>
                    </el-row>
                </template>
                <template v-else>
                    <div class="public-title"><el-button type="success" size="mini" style="margin-top:3px;" @click="addNewdata(0)" icon="el-icon-plus">新增</el-button> </div>
                    <el-table :data="dialog.tabledata2" size="mini" border stripe header-row-class-name="textcenter" max-height="370px">
                        <el-table-column
                            label="姓名">
                            <template slot-scope="scope">
                                {{scope.row.carId}}
                            </template>
                        </el-table-column>                
                        <el-table-column
                            label="性别">
                            <template slot-scope="scope">
                                {{scope.row.carType}}
                            </template>
                        </el-table-column>
                        <el-table-column
                            label="年龄" >
                            <template slot-scope="scope">
                                {{scope.row.companyName}}
                            </template>
                        </el-table-column>  
                        <el-table-column
                            label="工作单位" >
                            <template slot-scope="scope">
                                {{scope.row.companyName}}
                            </template>
                        </el-table-column>  
                        <el-table-column
                            label="受伤部位" >
                            <template slot-scope="scope">
                                {{scope.row.companyName}}
                            </template>
                        </el-table-column>             
                        <el-table-column
                            label="操作" fixed="right">
                            <template slot-scope="scope">
                                <el-button type="danger" icon="el-icon-delete" size="mini">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </template>
            </el-scrollbar>
            <div class="textcenter">
                <el-button type="primary">确定</el-button>  
                <el-button type="info" @click="dialog.isVisible = false">返回</el-button>
            </div>
            <!--内部弹窗-->
            <el-dialog
            width="35%"
            :title="dialog.dialog.type == 1?'新增家庭主要成员':'新增工作机会'"
            :visible.sync="dialog.dialog.isVisible"
            append-to-body>
                <el-form label-width="120px" size="mini">
                    <el-form-item label="姓名">
                        <el-input v-model="dialog.dialog.name"></el-input>
                    </el-form-item>
                    <el-form-item label="对方责任人性别">
                        <el-select v-model="dialog.addsex" placeholder="请选择" style="width:100%;">
                            <el-option
                            v-for="item in select.sexs"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="年龄">
                        <el-input v-model="dialog.dialog.address"></el-input>
                    </el-form-item> 
                    <el-form-item label="工作单位">
                        <el-input v-model="dialog.dialog.address"></el-input>
                    </el-form-item> 
                    <el-form-item label="受伤部位">
                        <el-input v-model="dialog.dialog.address"></el-input>
                    </el-form-item>                   
                </el-form>
                <div class="textcenter">
                    <el-button type="primary" size="mini">确定</el-button>  
                    <el-button type="info" size="mini" @click="dialog.dialog.isVisible = false">返回</el-button>
                </div>
            </el-dialog>
    </el-dialog>
</div>
</template>
<script>
export default {
    data(){
        return {
            form:{
                test:''
            },
            tabledata:[],
            page:{
              now:1,
              pagesize:10,
              sizes:[2,10, 20, 50, 100],
              total:0,
              key:''
            },
            select:{
                carids:[],
                responsibleer:[],
                sexs:[
                    {label:'男',value:'男'},
                    {label:'女',value:'女'}
                ],
                accidenttype:[],
                operators:[],
                dutys:[]
            },
            dialog:{
                isVisible:false,
                checked:true,
                navtab:{
                    arr:['交通事故基本信息登记','人员伤亡情况'],
                    currIndex:0
                },
                picSrc:'test',
                name:'',
                dialog:{
                    isVisible:false
                }
            }
        }
    },
    mounted(){
        
    },
    methods:{
        dialogNav(index){
            this.dialog.navtab.currIndex = index;
        },
        addNewdata(type){
            this.dialog.dialog.type = type ;
            this.dialog.dialog.isVisible = true;
        },
        handleChange(file, fileList){
            console.log("file",file)
        },
        search(){
            alert("search")
        },
        //分页
        handleSizeChange(pagesize){
            this.page.pagesize = pagesize;
            this.search(true,true);
        },
        handleCurrentChange(pageno){
            this.page.now = pageno;
            this.search(true,true);
        }

    }
}
</script>